package pers.wensheng.patterns.behavioral_pattern.command_pattern;

import pers.wensheng.patterns.behavioral_pattern.command_pattern.entity.Order;
import pers.wensheng.patterns.behavioral_pattern.command_pattern.entity.OrderCommand;
import pers.wensheng.patterns.behavioral_pattern.command_pattern.entity.SeniorChef;
import pers.wensheng.patterns.behavioral_pattern.command_pattern.entity.Waitor;

/**
 * 命令模式
 */
public class Client {
    public static void main(String[] args) {
        //第一个订单对象
        Order order1 = new Order();
        order1.setDiningTable(1);
        order1.setFood("西红柿鸡蛋面",1);
        order1.setFood("小杯可乐",2);

        Order order2 = new Order();
        order2.setDiningTable(2);
        order2.setFood("尖叫肉丝盖饭",1);
        order2.setFood("小杯雪碧",1);

        //创建厨师对象
        SeniorChef chef = new SeniorChef();

        //创建命令对象
        OrderCommand cmd1 = new OrderCommand(chef,order1);
        OrderCommand cmd2 = new OrderCommand(chef,order2);

        //创建调用者服务员对象
        Waitor waitor = new Waitor();
        waitor.setCommand(cmd1);
        waitor.setCommand(cmd2);

        //让服务员发起命令
        waitor.orderUp();


    }
}
